<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <link rel="apple-touch-icon" sizes="76x76" href="{_INDEX_STATIC_}/moban/assets/img/apple-icon.png">
    <link rel="icon" type="image/png" href="{_INDEX_STATIC_}/moban/assets/img/favicon.png">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>成果审核 | {$system_name}</title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
        name='viewport' />
    <link href="{_INDEX_STATIC_}/moban/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="{_INDEX_STATIC_}/moban/assets/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
    <link href="{_INDEX_STATIC_}/moban/assets/css/font-awesome.min.css" rel="stylesheet" />
</head>

<body class="index-page sidebar-collapse">

    <!-- 引入导航栏 -->
    {include file='public/header'}

    <div class="container" style="min-height: 490px;">
        <!-- 个人信息 -->
        <div class="row">
            <div class="col-md-12">
                <h3>成果审核</h3>
            </div>

            <!-- <button class="btn btn-info">全部通过</button> -->
            <button class="btn btn-danger" onclick="back()">返回上一页</button>
        </div>

        {volist name="classify_table_other_data" id="ctod_row" key="i"}
        <div class="row">
            {volist name="classify_table_info.table_content.names" id="row" key="j"}
            <div class="col-md-6">
                <div class="input-group">
                    <span class="input-group-addon">
                        &nbsp;{$row}
                    </span>
                    {if
                    condition="$classify_type_list[$classify_table_info.table_content.selects[$j-1]-1]['name'] ==
                    '时间'"}
                    <div class="form-control">
                        {$classify_table_other_data[$i-1][$classify_table_info.table_content.cols[$j-1]] | date='Y-m-d'}
                    </div>
                    {else /}
                    {if
                    condition="$classify_type_list[$classify_table_info.table_content.selects[$j-1]-1]['name'] ==
                    '数值'"}
                    <div class="form-control">
                        {$classify_table_other_data[$i-1][$classify_table_info.table_content.cols[$j-1]] / 100 |
                        floatval}
                    </div>
                    {else /}
                    <div class="form-control">
                        {$classify_table_other_data[$i-1][$classify_table_info.table_content.cols[$j-1]]}
                    </div>
                    {/if}
                    {/if}
                </div>
            </div>
            {/volist}
            <div class="col-md-12">
                <div class="input-group">
                    <span class="input-group-addon">
                        &nbsp;上传驳回的信息 :
                    </span>
                    <div class="form-control">
                        {$classify_table_other_data[$i-1]['note']}
                    </div>
                </div>
            </div>

            <div class="col-md-12" style="text-align: center;margin-bottom: 20px;">
                <button class="btn btn-success"
                    onclick="through('{$classify_table_other_data[$i-1][\'id\']}')">通过</button>
                <button class="btn btn-danger"
                    onclick="rejected('{$classify_table_other_data[$i-1][\'id\']}')">驳回</button>
            </div>
        </div>
        {/volist}
    </div>

    <!-- 引入页脚 -->
    {include file='public/footer'}
    <script>

        // 通过
        function through(id) {

            layer.confirm('是否确认通过？', {
                btn: ['是', '否'] //按钮
            }, function () {
                $.ajax({
                    url: "{:url('achievement_audit/through')}",
                    data: {
                        'id': id,
                        'cid': "{$cid}",
                        'uid': "{$uid}",
                    },
                    type: "POST",
                    dataType: "JSON",
                    async: true,
                    success: function (res) {
                        // 返回结果处理
                        if (res.code == 0) {
                            return layer.msg(res.msg, { icon: 1, time: 900 }, function () {
                                location.reload()
                            });
                        } else {
                            return layer.msg(res.msg, { icon: 2, time: 900 });
                        }
                    }
                });
            }, function () { });

        }

        // 驳回
        function rejected(id) {
            layer.prompt({ title: '请填写要驳回的理由', formType: 2 }, function (note, index) {
                layer.close(index);
                $.ajax({
                    url: "{:url('achievement_audit/rejected')}",
                    data: {
                        'id': id,
                        'cid': "{$cid}",
                        'uid': "{$uid}",
                        'note': note
                    },
                    type: "POST",
                    dataType: "JSON",
                    async: true,
                    success: function (res) {
                        // 返回结果处理
                        if (res.code == 0) {
                            return layer.msg(res.msg, { icon: 1, time: 900 }, function () {
                                location.reload()
                            });
                        } else {
                            return layer.msg(res.msg, { icon: 2, time: 900 });
                        }
                    }
                });
            });
        }

        // 返回 
        function back() {
            redirect_url("{:url('achievement_audit/details')}?cid={$cid}")
        }

        // 重定向
        function redirect_url(url) {
            window.location.href = url;
        }
    </script>

</body>

</html>